<template>
  <a-card :bordered="false" style="width: 100%;text-align: center;">
    <div style="font-size: 20px;letter-spacing: 1px;font-weight: bold">重置密码</div>
    <div class="content">
      <step2 v-if="currentTab === 0"/>
    </div>
    <a-form-item class="loginByUsername">
      <router-link :to="{ name: 'login' }">使用已有账户登录</router-link>
    </a-form-item>
  </a-card>
</template>

<script>
import Step1 from './Step1'
import Step2 from './Step2'
import Step3 from './Step3'
import Step4 from './Step4'

export default {
  name: 'Alteration',
  components: {
    Step1,
    Step2,
    Step3,
    Step4
  },
  data() {
    return {
      currentTab: 0,
      userList: {},
      // form
      form: null,
      validatorRules: {
        username: { rules: [{ required: true, message: '请输入用户名!' }, { validator: this.handleUsernameOrEmail }] },
        password: { rules: [{ required: true, message: '请输入密码!', validator: 'click' }] },
        mobile: { rules: [{ validator: this.validateMobile }] },
        inputCodeContent: { rule: [{ required: true, message: '请输入验证码!' }] },
        inputCode: { rules: [{ required: true, message: '请输入验证码!' }] }
      },
      state: {
        time: 60,
        smsSendBtn: false
      }
    }
  },
  methods: {

    // handler
    nextStep(data) {
      this.userList = data
      if (this.currentTab < 4) {
        this.currentTab += 1
      }
    },
    prevStep(data) {
      this.userList = data
      if (this.currentTab > 0) {
        this.currentTab -= 1
      }
    },
    finish() {
      this.currentTab = 0
    }
  }
}
</script>

<style lang="less" scoped>
/deep/ .ant-card-body {
  padding: 24px 0 0
}

.steps {
  max-width: 750px;
  margin: 16px auto;
}
</style>